package com.scott.ch110;

/**
 * @author 黄后林
 * @version 1.0
 * @note
 * @date 2021-12-18 22:50:10
 */
public class Client {

    public static void main(String[] args) {

        RoleService<Number> service = new RoleService<>();
        service.setData(100);
        print(service);

        RoleService<Integer> service2 = new RoleService<>();
        service2.setData(200);
        // 用类型通配符解决
        print(service2);

    }

    public static void  print(RoleService<?> service) {

        // 注意：这里只能用Object去接受
        Object data = service.getData();
        System.out.println(data);

    }
}
